package com.byx.chatclient.utils;

import android.content.Context;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry;
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;
import com.byx.chatclient.factory.RetrofitFactory;

import java.io.InputStream;

/**
 * GlideModule
 *
 * @author Superb
 * @date 2021/4/6 21:14
 */
@com.bumptech.glide.annotation.GlideModule
public class GlideModule extends AppGlideModule {

    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        //设置请求方式为okhttp 并设置okhttpClient的证书及超时时间
        OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(OkHttpUtils.getInstance());
        registry.replace(GlideUrl.class, InputStream.class,factory);
    }
}
